package cn.itcast.bos.dao.bc;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import cn.itcast.bos.domain.bc.DecidedZone;
import cn.itcast.bos.domain.bc.Subarea;

//  SubAreaDao 目前不具备 条件分页查询 功能  扩展接口  JpaSpecificationExecutor   spring data jpa  通过该接口 完成多条件分页查询
public interface SubAreaDao extends JpaRepository<Subarea, String>, JpaSpecificationExecutor<Subarea> {
	@Query("from Subarea where decidedZone is null")
	public List<Subarea> findByNoAssociationsDecidedZone();

	@Modifying
	@Query("update Subarea set decidedZone = ?2 where id = ?1")
	public void assignSubareasToDecidedZone(String id, DecidedZone model);

}
